
<script setup>
import { useStore } from '@/store/index'
import { storeToRefs } from 'pinia';

const store = useStore()

let { name , num , changeNum} = storeToRefs(store);

let change = () => {
  store.$patch(state=>{
    state.num ++;
    state.name = 'xxx';
  })
  // num.value++;
  // name.value = '112312';


}
</script>

<template>
  <h1>1组件</h1>
  {{ changeNum }}
  {{ name }}
  {{ num }}
  <hr>
  <button @click="change">修改</button>
</template>